'''
Created on Mar 18, 2012

@author: phuongdongbk
'''

class Stack():
    def __init__(self,list1=[]):
        self.list1 = list1
    def pop(self): 
        if  self.length():
            result= self.list1[-1]
            self.list1 = list(self.list1[0:-1])
            return result
    def top(self):
        return self.list1[-1]
    def length(self):
        return len(self.list1)
    def push(self,a):
        self.list1.append(a)

dong = Stack()
dong.pop()
dong.push(10)
dong.push(20)
dong.push(30)
print dong.list1
print dong.top()
print dong.length()